#include <iostream>

using namespace std;

int main(int argc, char* argv[])
{
	int t, idx = 0;
	long r = 1000000007;
	float a;
	int* result;
	int* inter;
	cin>>t;
	if (cin.fail()) {
		return 1;
	} else if (t < 0 || t > 10000) {
		return 1;
	} else {
		result = new int[t];
		for (int j = 0; j < t; j++) {
			cin>>a;
			if (cin.fail()) {
				delete[] result;
				return 1;
			}
			if (a < -1000.0 || a > 1000.0) {
				delete[] result;
				return 1;
			}
			int n = (int)a;
			int size;
			
			if (a < 0.0) {
				size = 1;
			} else if (a >= 0.0 && a < 1.0) {
				size = 2;
			} else if (a >= 1.0 && a < 2.0) {
				size = 3;
			} else if (a >= 2.0 && a < 3.0) {
				size = 4;
			} else {
				float c = n + 0.14f;
				if (a < c) {
					size = 4 + (n - 2) * 2 - 1;
				} else {
					size = 4 + (n - 2) * 2;
				}
			}

			inter = new int[size];

			for (int i = 0; i < size; i++) {
				if (i == 0) {
					inter[i] = 0;
				} else if (i == 1) {
					inter[i] = 1;
				} else if (i == 2){
					inter[i] = 1;
				} else if (i == 3) {
					inter[i] = 1;
				} else if (i == 4) {
					inter[i] = 1;
				} else {
					inter[i] = inter[i - 2] + inter[(i - 3) / 2];
				}
			}
			result[idx++] = inter[size - 1];
			delete[] inter;
		}
		for (int i = 0; i < idx; i++) {
			cout<<result[i]<<endl;
		}
		delete[] result;
	}
	return 0;
}